<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include  page="../common/file.jsp"/>
<head>
</head>
<body class="dialog_body">
<form id="submit_form" action="${pageContext.request.contextPath}/menu/update" method="post" target="_parent">
<input type="hidden" id="menuId" name="menuId" value="${menu.menuId }"/>
<div class="dialog-two-div">
	<table class="dialog-two-table">
		<tr>
			<td class="dialog-td-right">上级菜单</td>
			<td class="dialog-td-left">
				<c:if test="${menu.parentId == null}">
					<select class="select" id="parentId" name="parentId" style="width: 200px; height: 30px;" readonly="readonly">
				</c:if>
				<c:if test="${menu.parentId != null}">
					<select class="select" id="parentId" name="parentId" style="width: 200px; height: 30px;">
				</c:if>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">菜单名称</td>
			<td class="dialog-td-left">
				<input type="text" id="menuName" name="menuName" value="${menu.menuName }" maxlength="20" placeholder="请输入菜单名称" validate="not-null,special-char"/>
				<span class="redtext">*</span>
				<div style="clear:both;display:none"></div>
				<span id="sameNenuName" style="margin-left:0px"></span>
			</td>
		</tr>
		<tr id="dataIdDl">
			<td class="dialog-td-right">请求模块</td>
			<td class="dialog-td-left">
				<input type="text" id="dataId" name="dataId" value="${menu.dataId }" maxlength="20" placeholder="请输入请求模块"/>
			</td>
		</tr>
		<tr id="dataHrefDl">
			<td class="dialog-td-right">请求路径</td>
			<td class="dialog-td-left">
				<input type="text" id="dataHref" name="dataHref" value="${menu.dataHref }" maxlength="50" placeholder="请输入请求路径"/>
			</td>
		</tr>
		<tr id="iconPathDl">
			<td class="dialog-td-right">图标路径</td>
			<td class="dialog-td-left">
				<input type="text" id="iconPath" name="iconPath" value="${menu.iconPath }" maxlength="100" placeholder="请输入图标路径"/>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">状态</td>
			<td class="dialog-td-left">
				<select class="chosen-select form-control" id="status" name="status">
			        <c:if test="${menu.status eq '1' }">
						<option value="1" selected>有效</option>
						<option value="0" >无效</option>
					</c:if>
					<c:if test="${menu.status eq '0' }">
						<option value="1" >有效</option>
						<option value="0" selected>无效</option>
					</c:if>
		        </select>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">类型</td>
			<td class="dialog-td-left">
				<select class="chosen-select form-control" id="type" name="type">
			        <c:if test="${menu.type eq '1' }">
						<option value="1">菜单</option>
						<option value="2">按钮</option>
					</c:if>
					<c:if test="${menu.type eq '2' }">
						<option value="2">按钮</option>
						<option value="1">菜单</option>
					</c:if>
		        </select>
			</td>
		</tr>
		<tr>
			<td class="dialog-td-right">序列</td>
			<td class="dialog-td-left">
				<input type="text" id="orderNo" name="orderNo" value="${menu.orderNo }" maxlength="10" placeholder="请输入序列" validate="not-null,pos-int-no0"/>
				<span class="redtext">*</span>
				<div style="clear:both;display:none"></div>
				<span id="sameOrderNo" style="margin-left:0px"></span>
			</td>
		</tr>
	</table>
	<table class="dialog-two-table dialog-table-submit">
		<tr class="dialog-two-button">
			<td colspan=4 >
				<button type="button" class="btn btn-warning submit-btn">提 交</button>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<button type="button" class="btn btn-default cancel-btn" target="_self">返 回</button>
			</td>
		</tr>
	</table>
</div>
</form>
<script type="text/javascript">
	//下拉菜单树(上级菜单)
	var ctxt = "${pageContext.request.contextPath}";
	$('#parentId').combotree({
		url : ctxt+'/menu/findAllTree',
	    parentField : 'pid',
	    lines : true,
	    panelHeight : 'auto',
	    value : '${menu.parentId}',
	});

	//页面初始化判断是否显示dataId和dataHref
	$(function() {
		var parentId = "${menu.parentId}";
		var type = "${menu.type}";
		if(parentId!="" && parentId!=null && type=='1') {
			$('#dataIdDl').css("display","table-row");
			$('#dataHrefDl').css("display","table-row");
			//$('#iconPathDl').css("display","none");
		}
	});
	
	//提交保存
	function submitForm() {
		
		var menuId = $('#menuId').val();
		var parentId = $('.textbox-value').attr("value");
		if(menuId == parentId) {
			/* art.dialog.tips('不能将菜单放入其自身菜单内！', 2);
			scroll(0,0); */
			$('#sameNenuName').html("<font style='float:left' color='red'>不能将菜单放入其自身菜单内！</font>");
			return false
		}
		
		$(".submit-btn").unbind("click");
		$('#submit_form').submit();
		
		return true;
	}
	
	//关闭窗口
	$('.cancel-btn').click(function() {
		art.dialog.close();
	});

	//下拉框初始化图形
	$(".chosen-select").chosen({disable_search_threshold: 10});
</script>
</body>

  
